package com.block.datapush.factory;

import com.block.common.util.ApplicationContextUtil;
import com.block.datapush.enums.PushApi2Enum;
import com.block.datapush.enums.PushApiEnum;
import com.block.datapush.service.IPushApi2Service;
import com.block.datapush.service.apipush.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 掩码撞库工厂
 * */
public class PushApi2Factory {

    private static final Map<String, Class<? extends IPushApi2Service>> serviceMap = new HashMap<>();

    static {
        serviceMap.put(PushApi2Enum.DEFAULT_API_MASK.getValue(), DefaultAPIMaskPushApiService.class);
        serviceMap.put(PushApi2Enum.COMMONAPISMASK.getValue(), CommonApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.COMMONAPIBMASK.getValue(), CommonApiBMaskPushApiService.class);
        serviceMap.put(PushApi2Enum.LONGYANMASKAPIS.getValue(), LongYanMaskApisService.class);
        serviceMap.put(PushApi2Enum.DAEAPISMASK.getValue(), DaEApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.HAOHANSSQ.getValue(), HaoHanYouJieApiService.class);
        serviceMap.put(PushApi2Enum.XINDAIMASKAPSMASK.getValue(), XinDaiApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.ZHENXIANGAPISMASK.getValue(), ZhenXiangApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.JINTONGBAOAPIS.getValue(), JinTongBaoApiSService.class);
        serviceMap.put(PushApi2Enum.HAOHANYOUJIEMASKAPIS.getValue(), HaoHanYouJieMaskApiService.class);
        serviceMap.put(PushApi2Enum.XINFENGMASKAPIS.getValue(), XinFengApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.HUIYUANMASKPAIS.getValue(), HuiYuanApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.YIYOUHUAMASKAPIS.getValue(), YiYouHuaApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.JIKEMASKAPIS.getValue(), JiKeApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.LESHANTONGMASKAPIS.getValue(), LeShanTongApiSMaskPushService.class);
        serviceMap.put(PushApi2Enum.YANGXINHUAMASKPAIS.getValue(), YangXinHuaApisMaskPushApiService.class);
        serviceMap.put(PushApi2Enum.JINMAOAPISMASK.getValue(), JinMaoApisMaskService.class);


    }

    public static IPushApi2Service getService(String pushType){
        if (serviceMap.containsKey(pushType)){
            Class<? extends IPushApi2Service> aClass = serviceMap.get(pushType);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }


}
